package net.sppan.base.service.impl;

import net.sppan.base.dao.IMgUserDao;
import net.sppan.base.dao.support.IBaseDao;
import net.sppan.base.entity.mgEntity.MgUser;
import net.sppan.base.service.IMgUserService;
import net.sppan.base.service.support.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 用户账户表  服务实现类
 * </p>
 *
 * @author SPPan
 * @since 2016-12-28
 */
@Service
public class MgUserServiceImpl extends BaseServiceImpl<MgUser, Integer> implements IMgUserService {

	@Autowired
	private IMgUserDao MgUserDao;
	

	@Override
	public IBaseDao<MgUser, Integer> getBaseDao() {
		return this.MgUserDao;
	}


	@Override
	public MgUser findByUserName(String username) {
		return null;
	}

	@Override
	public MgUser findByTelephone(String telephone) {
		MgUser mgUser = MgUserDao.findByTelephone(telephone);
		return mgUser;
	}

	@Override
	public void saveOrUpdate(MgUser user) {
		if(user.getId()!=null){
			update(user);
		}else{
			save(user);
		}

	}

	@Override
	public long countAllByAppointmentTime(String appointmentTime) {
		return MgUserDao.countAllByAppointmentTime(appointmentTime);
	}


	@Override
	public Object[] queryAppointtimeNum() {
		return MgUserDao.queryAppointtimeNum();
	}

	@Override
	public Page<MgUser> findAllByLike(String searchText, PageRequest pageRequest) {
		return null;
	}
}
